package com.sokal.easycare.modules.service.entity;

import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.google.common.collect.Lists;

import com.sokal.easycare.common.persistence.DataEntity;
import com.sokal.easycare.modules.product.entity.product.ProProduct;

/**
 * 服务Entity
 * 
 * @author liliangdong
 * @version 2017-03-27
 */
public class SerService extends DataEntity<SerService> {

	private static final long serialVersionUID = 1L;
	private String name; // 服务名称
	private ProProduct proProduct; // 所属产品
	private String type; // 服务类型
	private Double price; // 价格
	private String unit; // 计量单位
	private Date effectiveStartDate; // 生效日期
	private Date effectiveEndDate; // 失效日期
	private List<SerAction> serActionList = Lists.newArrayList(); // 子表列表

	public SerService() {
		super();
	}

	public SerService(String id) {
		super(id);
	}

	public SerService(ProProduct proProduct) {
		this.proProduct = proProduct;
	}

	@Length(min = 1, max = 255, message = "服务名称长度必须介于 1 和 255 之间")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public ProProduct getProProduct() {
		return proProduct;
	}

	public void setProProduct(ProProduct proProduct) {
		this.proProduct = proProduct;
	}

	@Length(min = 1, max = 1, message = "服务类型长度必须介于 1 和 1 之间")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	@Length(min = 0, max = 20, message = "计量单位长度必须介于 0 和 20 之间")
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEffectiveStartDate() {
		return effectiveStartDate;
	}

	public void setEffectiveStartDate(Date effectiveStartDate) {
		this.effectiveStartDate = effectiveStartDate;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEffectiveEndDate() {
		return effectiveEndDate;
	}

	public void setEffectiveEndDate(Date effectiveEndDate) {
		this.effectiveEndDate = effectiveEndDate;
	}

	public List<SerAction> getSerActionList() {
		return serActionList;
	}

	public void setSerActionList(List<SerAction> serActionList) {
		this.serActionList = serActionList;
	}
}